// 扩展运算符 + some 实现
const flatter = (arr) => {
    while(arr.some(num => Array.isArray(num))){
        arr = [].concat(...arr);
    }
    return arr;
}

console.log(flatter([1,2,[3,4,[5,6]]]))